using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMSalesReportController
    {
        private clsConnect cls = new clsConnect();

        #region[Get-Data]
        public DataTable BindGirdTMSalesReport()
        {
            return cls.BindGridData("sp_TMSalesReport");
        }
        public DataTable BindGirdTMSalesReport_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMSalesReport_Detail_Edit", "@Id", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool UpdateTMSalesReport(clsTMSalesReportProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@SalesReport_ID", data.SalesReport_ID);
            cls.AddParameter("@SalesReport_Date", data.SalesReport_Date);
            cls.AddParameter("@SalesReport_Direction", data.SalesReport_Direction);
            cls.AddParameter("@SalesReport_Revenue", data.SalesReport_Revenue);
            cls.AddParameter("@SalesReport_Liters_Of_Oil", data.SalesReport_Liters_Of_Oil);
            cls.AddParameter("@SalesReport_Oil_Money", data.SalesReport_Oil_Money);
            cls.AddParameter("@SalesReport_Salary", data.SalesReport_Salary);
            cls.AddParameter("@SalesReport_Cost", data.SalesReport_Cost);
            cls.AddParameter("@SalesReport_Car_Salary", data.SalesReport_Car_Salary);
            cls.AddParameter("@SalesReport_Bridges", data.SalesReport_Bridges);
            cls.AddParameter("@SalesReport_Stevedorage", data.SalesReport_Stevedorage);
            cls.AddParameter("@SalesReport_Wage", data.SalesReport_Wage);
            cls.AddParameter("@SalesReport_Fixed_Cost", data.SalesReport_Fixed_Cost);
            cls.AddParameter("@SalesReport_Total_Minutes", data.SalesReport_Total_Minutes);
            cls.AddParameter("@SalesReport_Total_Costs", data.SalesReport_Total_Costs);
            cls.AddParameter("@SalesReport_Profit_Loss", data.SalesReport_Profit_Loss);
            cls.AddParameter("@SalesReport_Note", data.SalesReport_Note);
            cls.ExecuteNonQuery("sp_TMSalesReport_Update");
            return true;
        }
        public bool DeleteTMSalesReport(int id)
        {
            cls.Delete("sp_TMSalesReport_Delete", "@SalesReport_ID", id);
            return true;
        }
        #endregion

        #region[Search-Fillter]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMSalesReport_Search", "@KEYWORDS", keywords);
        }
        public DataTable TMSalesReport_Fillter_Date(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMSalesReport_Fillter_Date", DateBegin, EndBegin);
        }
        #endregion

        #region[Total]
        public DataTable Total()
        {
            return cls.BindGridData("sp_TMSalesReport_Total_Revenue_COSTS_Loss__All");
        }
        public DataTable TotalAll(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMSalesReport_Total_Revenue_COSTS_Loss", DateBegin, EndBegin);
        }
        #endregion
    }
}